package firstStage.part3;

import java.util.Random;
import java.util.Scanner;

public class RandomTest {
    public static void main(String[] args) {
        Random random = new Random();
        int number = random.nextInt(100) + 1;
        System.out.println("请输入你所猜的数字：");
        while (true) {
            Scanner scanner = new Scanner(System.in);
            int guessNumber = scanner.nextInt();
            if (guessNumber > number) {
                System.out.println("你猜的数字" + guessNumber + "大了");
            } else if (guessNumber < number) {
                System.out.println("你猜的数字" + guessNumber + "小了");
            } else {
                System.out.println("恭喜你猜对了！！！");
                break;
            }
            scanner.close();
        }
    }
}
